/***************************************************************************

-------------------
    begin                : 
    copyright            : kuzkok
    email                : kuzkok at gmail.com

***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*   
*   Данная программа является свободным программным обеспечением;         *
*   Вы можете распространять ее и/или модифицировать в соответствии с     *
*   GNU General Public License опубликованной Фондом свободного           *
*   программного обеспечения; используемая версия лицензии - 2 или        *
*   (по вашему выбору) любая более поздняя                                *
***************************************************************************/

#include "onlinepointforofflinefeature.h"

OnlinePointForOfflineFeature::OnlinePointForOfflineFeature(QString theTableName) :
    OnlinePoint(theTableName)
{
}

OnlinePointForOfflineFeature::OnlinePointForOfflineFeature(QUuid theEventID, QString theTableName) :
        OnlinePoint(theEventID, theTableName)
{
    if(objectState)
    {
        offsetAngle = selectQuery->value(selectQuery->record().indexOf("offsetangle")).toDouble();
        offsetDistance = selectQuery->value(selectQuery->record().indexOf("offsetdistance")).toDouble();
        stationLocated = selectQuery->value(selectQuery->record().indexOf("stationlocated")).toString();
    }
}

OnlinePointForOfflineFeature::buildInsertStatement()
{
    OnlinePoint::buildInsertStatement();
    insertStatementFields += ", offsetangle"
                             ", offsetdistance"
                             ", stationlocated";
    insertStatementValues += ", offsetangle"
                             ", offsetdistance"
                             ", stationlocated";
}

OnlinePointForOfflineFeature::buildUpdateStatement()
{
    OnlinePoint::buildUpdateStatement();
    updateStatement += ", offsetangle = :offsetangle"
                       ", offsetdistance = :offsetdistance"
                       ", stationlocated = :stationlocated";
}

OnlinePointForOfflineFeature::bindQueryValues(QSqlQuery &query)
{
    OnlinePoint::bindQueryValues(query);
    query.bindValue(":offsetangle", offsetAngle);
    query.bindValue(":offsetdistance", offsetDistance);
    query.bindValue(":stationlocataed", stationLocated);
}
